{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "northern-plastic",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr = [1,2,3,4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "after-sharing",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.index(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "civilian-publication",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "25"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import string\n",
    "string.ascii_lowercase.index(\"z\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "adjusted-renaissance",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(25 + 2) % len(string.ascii_lowercase)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "brief-savage",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "26"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(string.ascii_lowercase)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "smooth-communication",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'ab'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"abcd\"[:2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "collectible-degree",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'cd'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"abcd\"[2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "opened-label",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/shifting-letters/\n",
    "\n",
    "\n",
    "Time Limit Exceeded\n",
    "\n",
    "\n",
    "```python\n",
    "import string\n",
    "\n",
    "def shift(text, by_num_of):\n",
    "    string.ascii_lowercase\n",
    "    new_text = \"\"\n",
    "    for c in text:\n",
    "        index = string.ascii_lowercase.index(c)\n",
    "        index += by_num_of\n",
    "        index = index % len(string.ascii_lowercase)\n",
    "        new_text += string.ascii_lowercase[index]\n",
    "    return new_text\n",
    "    \n",
    "class Solution:\n",
    "    def shiftingLetters(self, S: str, shifts: List[int]) -> str:\n",
    "        #7:22\n",
    "        for index, num in enumerate(shifts, start=1):\n",
    "            S = shift(S[:index], num) + S[index:]\n",
    "        return S\n",
    "        #7:32\n",
    "```    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "express-waterproof",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
